package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.BusinessProcessMain;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/BusinessProcessMainMapper.class */
public interface BusinessProcessMainMapper {
    @ResultMap({"map"})
    @Select({"select * from  business_process_main where id = #{id}"})
    BusinessProcessMain queryById(Integer num);

    @Results(id = "map", value = {@Result(property = "userId", column = "user_id"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "interfaceAddress", column = "interface_address"),
            @Result(property = "projectType", column = "project_type")})
    @Select({"<script>" +
            "select bpm.*,u.name as userName  from business_process_main bpm " +
            "left join user u on bpm.user_id = u.id " +
            "<where> " +
            "<if test='id != null '>bpm.id=#{id} </if>" +
            "<if test='name != null and name.length &gt; 0'>and bpm.name like concat('%',#{name},'%') </if>" +
            "<if test='type != null'>and bpm.type=#{type} </if><if test='userId != null '>and and.user_id=#{userId} </if>" +
            "</where> " +
            "</script>"})
    List<BusinessProcessMain> queryAll(BusinessProcessMain businessProcessMain);

    @Insert({"insert into business_process_main(name,type,user_id,create_time,interface_address,project_type)" +
            "values(#{name},#{type},#{userId},#{createTime},#{interfaceAddress},#{projectType})"})
    int insert(BusinessProcessMain businessProcessMain);

    @Update({"<script>" +
            "update business_process_main " +
            "<set>" +
            "<if test='name != null and name.length &gt; 0'> " +
            "name = #{name},</if><if test='type != null '> type = #{type}," +
            "</if>" +
            "<if test='userId != null '> " +
            "user_id = #{userId}," +
            "</if>" +
            "<if test='interfaceAddress != null and interfaceAddress.length &gt; 0'> " +
            "interface_address = #{interfaceAddress}," +
            "</if>" +
            "<if test='projectType != null and projectType.length &gt; 0'> " +
            "project_type = #{projectType}" +
            "</if>" +
            "</set>" +
            "where id = #{id}" +
            "</script>"})
    int update(BusinessProcessMain businessProcessMain);

    @Delete({"delete from business_process_main where id = #{id}"})
    int deleteById(Integer num);
}